class Vote < DatabaseObject

  attr_accessor :id, :grade

  def initialize(image, user, grade)
    @id = $database.votes.last.id + 1
    @image = image.id
    @user = user.id
    @grade = grade
    raise "user must be User isntance" unless user.class == User
    raise "image must be Image instance" unless image.class == Image
    raise "@user must be Integer" unless @user.kind_of? Integer
    raise "@image must be Integer" unless @image.kind_of? Integer
    raise "grade must be boolean" unless !!@grade == @grade
  end

end